//
//  MYHTTPManager.h
//  JQLive
//
//  Created by Bruce on 2019/11/28.
//  Copyright © 2019 mlqk. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

///服务模块类型
typedef NS_ENUM(NSUInteger, MYServiceModuleType) {
    ///通用类型 前缀
    PublicBaseUrl_Type = 0,


};

@interface MYHTTPManager : NSObject
/**
 *  网络状态检测
 *  -1:位置网络 0:网络不可用 1:2g-4g 2:wifi
 */
+ (void)monitoringNetworkState:(void (^)(NSInteger status))block;
#pragma mark 普通一般的网络请求

/**
 封装AFN POST请求

 @param urlString 请求链接
 @param parameters 请求参数
 @param MYServiceModuleType 服务模块类型
 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)postAFNWithUrl:(NSString *)urlString
            parameters:(id)parameters
   MYServiceModuleType:(MYServiceModuleType)MYServiceModuleType
         successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
         failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;

/**
 封装AFN GET请求
 
 @param urlString 请求链接
 @param parameters 请求参数
 @param MYServiceModuleType 服务模块类型
 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)getAFNWithUrl:(NSString *)urlString
           parameters:(id)parameters
  MYServiceModuleType:(MYServiceModuleType)MYServiceModuleType
        successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
        failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;

/**
 封装AFN DELETE请求
 
 @param urlString 请求链接
 @param parameters 请求参数
 @param MYServiceModuleType 服务模块类型
 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)deleteAFNWithUrl:(NSString *)urlString
              parameters:(id)parameters
     MYServiceModuleType:(MYServiceModuleType)MYServiceModuleType
           successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
           failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;
/**
 封装AFN PUT请求
 
 @param urlString 请求链接
 @param parameters 请求参数
 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)putAFNWithUrl:(NSString *)urlString
            parameters:(id)parameters
MYServiceModuleType:(MYServiceModuleType)MYServiceModuleType
         successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
        failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;

/**
 *  单文件上传
 *
 *  @param urlString      url地址
 *  @param params         params参数
 *  @param mimeType         mimeType参数
 *

 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)requestDataWithURL:(NSString *)urlString
                withParams:(NSMutableDictionary *)params
                  withData:(NSData *)fileData
              withDataName:(NSString *)dataName
              withFileName:(NSString *)fileName
                  mimeType:(NSString *)mimeType
                  progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress))uploadProgressZSP
             successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
             failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;
/**
 *  多文件上传
 *
 *  @param dataArray      url地址
 *

 @param successHandle 请求成功回调
 @param failureHandle 请求失败回调
 */
+ (void)requestDataWithArray:(NSMutableArray *)dataArray
                  progress:(nullable void (^)(NSProgress * _Nonnull uploadProgress))uploadProgressZSP
             successHandle:(void(^)(NSURLSessionTask *task, id response))successHandle
             failureHandle:(void(^)(NSURLSessionTask *task, NSError *error))failureHandle;
@end

NS_ASSUME_NONNULL_END
